﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SlickGridNet.Serialization;

namespace SlickGridNet
{
	/// <summary>
	/// Explicit string class, has special converter for serialization.
	/// <para>Internal string value (<see cref="Value"/>) will be serialized as is without quotation.</para>
	/// </summary>
	public class ExplicitString : IExplicitString
	{
		private readonly string _value;

		/// <summary>
		/// Creates instance of ExplicitString class using specified value.
		/// </summary>
		/// <param name="value">String value of ExplicitString.</param>
		public ExplicitString(string value)
		{
			_value = value;
		}

		/// <summary>
		/// Returns stirng value of IExplicitString instance.
		/// </summary>
		public string Value { get { return _value; } }

		/// <summary>
		/// Creates and return new instance of ExplicitString using specified value.
		/// </summary>
		/// <param name="value">String value of ExplicitString.</param>
		/// <returns>Created instance.</returns>
		public static ExplicitString Create(string value)
		{
			return  new ExplicitString(value);
		}

		/// <summary>
		/// Returns string that contains current instance.
		/// </summary>
		/// <returns>Internal value of current instance.</returns>
		public override string ToString()
		{
			return _value;
		}
	}
}
